<?php

namespace App;

use Illuminate\Database\Eloquent\Model;


class Baby extends Model
{
    protected $table = 'baby';

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */

    protected $fillable = [
        'id',
        'wechat_user_id',
        'name',
        'sex',
        'birth',
        'guardian',
        'tel',
        'habitual_residence',
    ];

    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [];

    public function subscribes(){
        return $this->hasMany(CourseSubscribe::class,'baby_id');
    }

    public function town(){
        return $this->belongsTo(Town::class, 'town_id');
    }

    public function wechat_user(){
        return $this->belongsTo(WechatUser::class, 'wechat_user_id');
    }


}
